<?php

require_once("db_functions.php");

class crontab extends db_functions {
	
	function cronotab(){
		
	}
	
	function trimAddresses(){
		$adrese = array();
		
		// fetch addresses from komitenti
		$res = $this->select1("SELECT DISTINCT komitent_adresa FROM komitenti");
		if ($res !== false) {
			foreach ($res as $adr){
				$adrese[] = $adr[0];
			}
		}else{
			echo "Error";
			print_r($this);
			die();
		}
		
		
		// fetch addresses from komitenti_delatnosti
		$res = $this->select1("SELECT DISTINCT komdel_adresa_id FROM komitenti_delatnosti");
		if ($res !== false) {
			foreach ($res as $adr){
				$adrese[] = $adr[0];
			}
		}else{
			echo "Error";
			print_r($this);
			die();
		}
		
		echo count($adrese);
	}
	
}

?>